﻿namespace _3_FactoryMethod;

public class Square:Shape
{
    private double edge;

    private Square(double edge)
    {
        this.edge = edge;
    }

    internal static Square CreateInstance(double edge)
    {
        return new Square(edge);
    }

    public override double Area()
    {
        return edge * edge;
    }

    public override bool IsValid()
    {
        return edge > 0;
    }

    public override string ToString()
    {
        return "Square"+"\nedge "+edge+"\nArea "+Area();
    }
}